using System;
using System.Collections.Generic;
using System.Text;

namespace cb0tServer
{
    public partial class ServerCore
    {
        private bool OnSCASJoinCheck(SCASObject scas)
        {
            if (CoreSettings.scas_version < scas.scas_version)
            {
                return false;
            }

            return true;
        }

        private void OnSCASJoin(SCASObject scas)
        {
            scas.SendOutboundPacket(SCASOutboundPackets.LoginAck());

            foreach (UserObject u in UserPool.Users)
                if (u.IsSet())
                    if (u.logged_in)
                        scas.SendOutboundPacket(SCASOutboundPackets.UserListItem(u));

            if (this.link_client.IsLinking())
            {
                LinkedUserObject[] _lu = this.link_client.GetLinkedUsers();

                if (_lu != null)
                    foreach (LinkedUserObject _l in _lu)
                        scas.SendOutboundPacket(SCASOutboundPackets.LinkUserListItem(_l));
            }

            scas.SendOutboundPacket(SCASOutboundPackets.UserListEnd());
            scas.SendOutboundPacket(SCASOutboundPackets.MainTopic());
            scas.SendOutboundPacket(SCASOutboundPackets.MainUrl());
            scas.logged_in = true;
        }

        

    }
}
